package torque.generated;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.map.TableMap;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;





/**
 * Vaisseau Table
 *
 * This class was autogenerated by Torque on:
 *
 * [Mon Mar 05 18:12:38 CET 2012]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Vaisseau
 */
public abstract class BaseVaisseau extends BaseObject
{
    /** Serial version */
    private static final long serialVersionUID = 1330967558698L;

    /** The Peer class */
    private static final VaisseauPeer peer =
        new VaisseauPeer();


    /** The value for the vaisseauId field */
    private int vaisseauId;

    /** The value for the nom field */
    private String nom;

    /** The value for the attaque field */
    private int attaque;

    /** The value for the degats field */
    private int degats;

    /** The value for the champdeforce field */
    private int champdeforce;

    /** The value for the energie field */
    private int energie;


    /**
     * Get the VaisseauId
     *
     * @return int
     */
    public int getVaisseauId()
    {
        return vaisseauId;
    }


    /**
     * Set the value of VaisseauId
     *
     * @param v new value
     */
    public void setVaisseauId(int v) throws TorqueException
    {

        if (this.vaisseauId != v)
        {
            this.vaisseauId = v;
            setModified(true);
        }



        // update associated Inventaire
        if (collInventaires != null)
        {
            for (int i = 0; i < collInventaires.size(); i++)
            {
                ((Inventaire) collInventaires.get(i))
                        .setVaisseauId(v);
            }
        }

        // update associated Player
        if (collPlayers != null)
        {
            for (int i = 0; i < collPlayers.size(); i++)
            {
                ((Player) collPlayers.get(i))
                        .setVaisseauId(v);
            }
        }

        // update associated Cases
        if (collCasessRelatedByVaisseau1Id != null)
        {
            for (int i = 0; i < collCasessRelatedByVaisseau1Id.size(); i++)
            {
                ((Cases) collCasessRelatedByVaisseau1Id.get(i))
                        .setVaisseau1Id(v);
            }
        }

        // update associated Cases
        if (collCasessRelatedByVaisseau2Id != null)
        {
            for (int i = 0; i < collCasessRelatedByVaisseau2Id.size(); i++)
            {
                ((Cases) collCasessRelatedByVaisseau2Id.get(i))
                        .setVaisseau2Id(v);
            }
        }
    }

    /**
     * Get the Nom
     *
     * @return String
     */
    public String getNom()
    {
        return nom;
    }


    /**
     * Set the value of Nom
     *
     * @param v new value
     */
    public void setNom(String v) 
    {

        if (!ObjectUtils.equals(this.nom, v))
        {
            this.nom = v;
            setModified(true);
        }


    }

    /**
     * Get the Attaque
     *
     * @return int
     */
    public int getAttaque()
    {
        return attaque;
    }


    /**
     * Set the value of Attaque
     *
     * @param v new value
     */
    public void setAttaque(int v) 
    {

        if (this.attaque != v)
        {
            this.attaque = v;
            setModified(true);
        }


    }

    /**
     * Get the Degats
     *
     * @return int
     */
    public int getDegats()
    {
        return degats;
    }


    /**
     * Set the value of Degats
     *
     * @param v new value
     */
    public void setDegats(int v) 
    {

        if (this.degats != v)
        {
            this.degats = v;
            setModified(true);
        }


    }

    /**
     * Get the Champdeforce
     *
     * @return int
     */
    public int getChampdeforce()
    {
        return champdeforce;
    }


    /**
     * Set the value of Champdeforce
     *
     * @param v new value
     */
    public void setChampdeforce(int v) 
    {

        if (this.champdeforce != v)
        {
            this.champdeforce = v;
            setModified(true);
        }


    }

    /**
     * Get the Energie
     *
     * @return int
     */
    public int getEnergie()
    {
        return energie;
    }


    /**
     * Set the value of Energie
     *
     * @param v new value
     */
    public void setEnergie(int v) 
    {

        if (this.energie != v)
        {
            this.energie = v;
            setModified(true);
        }


    }

       


    /**
     * Collection to store aggregation of collInventaires
     */
    protected List collInventaires;

    /**
     * Temporary storage of collInventaires to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initInventaires()
    {
        if (collInventaires == null)
        {
            collInventaires = new ArrayList();
        }
    }


    /**
     * Method called to associate a Inventaire object to this object
     * through the Inventaire foreign key attribute
     *
     * @param l Inventaire
     * @throws TorqueException
     */
    public void addInventaire(Inventaire l) throws TorqueException
    {
        getInventaires().add(l);
        l.setVaisseau((Vaisseau) this);
    }

    /**
     * Method called to associate a Inventaire object to this object
     * through the Inventaire foreign key attribute using connection.
     *
     * @param l Inventaire
     * @throws TorqueException
     */
    public void addInventaire(Inventaire l, Connection con) throws TorqueException
    {
        getInventaires(con).add(l);
        l.setVaisseau((Vaisseau) this);
    }

    /**
     * The criteria used to select the current contents of collInventaires
     */
    private Criteria lastInventairesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getInventaires(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getInventaires()
        throws TorqueException
    {
        if (collInventaires == null)
        {
            collInventaires = getInventaires(new Criteria(10));
        }
        return collInventaires;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related Inventaires from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getInventaires(Criteria criteria) throws TorqueException
    {
        if (collInventaires == null)
        {
            if (isNew())
            {
               collInventaires = new ArrayList();
            }
            else
            {
                criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId() );
                collInventaires = InventairePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
                if (!lastInventairesCriteria.equals(criteria))
                {
                    collInventaires = InventairePeer.doSelect(criteria);
                }
            }
        }
        lastInventairesCriteria = criteria;

        return collInventaires;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getInventaires(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getInventaires(Connection con) throws TorqueException
    {
        if (collInventaires == null)
        {
            collInventaires = getInventaires(new Criteria(10), con);
        }
        return collInventaires;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related Inventaires from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getInventaires(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collInventaires == null)
        {
            if (isNew())
            {
               collInventaires = new ArrayList();
            }
            else
            {
                 criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
                 collInventaires = InventairePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
                 if (!lastInventairesCriteria.equals(criteria))
                 {
                     collInventaires = InventairePeer.doSelect(criteria, con);
                 }
             }
         }
         lastInventairesCriteria = criteria;

         return collInventaires;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related Inventaires from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getInventairesJoinVaisseau(Criteria criteria)
        throws TorqueException
    {
        if (collInventaires == null)
        {
            if (isNew())
            {
               collInventaires = new ArrayList();
            }
            else
            {
                criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
                collInventaires = InventairePeer.doSelectJoinVaisseau(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
            if (!lastInventairesCriteria.equals(criteria))
            {
                collInventaires = InventairePeer.doSelectJoinVaisseau(criteria);
            }
        }
        lastInventairesCriteria = criteria;

        return collInventaires;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related Inventaires from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getInventairesJoinObjetPartie(Criteria criteria)
        throws TorqueException
    {
        if (collInventaires == null)
        {
            if (isNew())
            {
               collInventaires = new ArrayList();
            }
            else
            {
                criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
                collInventaires = InventairePeer.doSelectJoinObjetPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(InventairePeer.VAISSEAU_ID, getVaisseauId());
            if (!lastInventairesCriteria.equals(criteria))
            {
                collInventaires = InventairePeer.doSelectJoinObjetPartie(criteria);
            }
        }
        lastInventairesCriteria = criteria;

        return collInventaires;
    }





    /**
     * Collection to store aggregation of collPlayers
     */
    protected List collPlayers;

    /**
     * Temporary storage of collPlayers to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initPlayers()
    {
        if (collPlayers == null)
        {
            collPlayers = new ArrayList();
        }
    }


    /**
     * Method called to associate a Player object to this object
     * through the Player foreign key attribute
     *
     * @param l Player
     * @throws TorqueException
     */
    public void addPlayer(Player l) throws TorqueException
    {
        getPlayers().add(l);
        l.setVaisseau((Vaisseau) this);
    }

    /**
     * Method called to associate a Player object to this object
     * through the Player foreign key attribute using connection.
     *
     * @param l Player
     * @throws TorqueException
     */
    public void addPlayer(Player l, Connection con) throws TorqueException
    {
        getPlayers(con).add(l);
        l.setVaisseau((Vaisseau) this);
    }

    /**
     * The criteria used to select the current contents of collPlayers
     */
    private Criteria lastPlayersCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPlayers(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getPlayers()
        throws TorqueException
    {
        if (collPlayers == null)
        {
            collPlayers = getPlayers(new Criteria(10));
        }
        return collPlayers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related Players from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getPlayers(Criteria criteria) throws TorqueException
    {
        if (collPlayers == null)
        {
            if (isNew())
            {
               collPlayers = new ArrayList();
            }
            else
            {
                criteria.add(PlayerPeer.VAISSEAU_ID, getVaisseauId() );
                collPlayers = PlayerPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(PlayerPeer.VAISSEAU_ID, getVaisseauId());
                if (!lastPlayersCriteria.equals(criteria))
                {
                    collPlayers = PlayerPeer.doSelect(criteria);
                }
            }
        }
        lastPlayersCriteria = criteria;

        return collPlayers;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getPlayers(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPlayers(Connection con) throws TorqueException
    {
        if (collPlayers == null)
        {
            collPlayers = getPlayers(new Criteria(10), con);
        }
        return collPlayers;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related Players from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getPlayers(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collPlayers == null)
        {
            if (isNew())
            {
               collPlayers = new ArrayList();
            }
            else
            {
                 criteria.add(PlayerPeer.VAISSEAU_ID, getVaisseauId());
                 collPlayers = PlayerPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(PlayerPeer.VAISSEAU_ID, getVaisseauId());
                 if (!lastPlayersCriteria.equals(criteria))
                 {
                     collPlayers = PlayerPeer.doSelect(criteria, con);
                 }
             }
         }
         lastPlayersCriteria = criteria;

         return collPlayers;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related Players from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getPlayersJoinVaisseau(Criteria criteria)
        throws TorqueException
    {
        if (collPlayers == null)
        {
            if (isNew())
            {
               collPlayers = new ArrayList();
            }
            else
            {
                criteria.add(PlayerPeer.VAISSEAU_ID, getVaisseauId());
                collPlayers = PlayerPeer.doSelectJoinVaisseau(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(PlayerPeer.VAISSEAU_ID, getVaisseauId());
            if (!lastPlayersCriteria.equals(criteria))
            {
                collPlayers = PlayerPeer.doSelectJoinVaisseau(criteria);
            }
        }
        lastPlayersCriteria = criteria;

        return collPlayers;
    }





    /**
     * Collection to store aggregation of collCasessRelatedByVaisseau1Id
     */
    protected List collCasessRelatedByVaisseau1Id;

    /**
     * Temporary storage of collCasessRelatedByVaisseau1Id to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCasessRelatedByVaisseau1Id()
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            collCasessRelatedByVaisseau1Id = new ArrayList();
        }
    }


    /**
     * Method called to associate a Cases object to this object
     * through the Cases foreign key attribute
     *
     * @param l Cases
     * @throws TorqueException
     */
    public void addCasesRelatedByVaisseau1Id(Cases l) throws TorqueException
    {
        getCasessRelatedByVaisseau1Id().add(l);
        l.setVaisseauRelatedByVaisseau1Id((Vaisseau) this);
    }

    /**
     * Method called to associate a Cases object to this object
     * through the Cases foreign key attribute using connection.
     *
     * @param l Cases
     * @throws TorqueException
     */
    public void addCasesRelatedByVaisseau1Id(Cases l, Connection con) throws TorqueException
    {
        getCasessRelatedByVaisseau1Id(con).add(l);
        l.setVaisseauRelatedByVaisseau1Id((Vaisseau) this);
    }

    /**
     * The criteria used to select the current contents of collCasessRelatedByVaisseau1Id
     */
    private Criteria lastCasessRelatedByVaisseau1IdCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCasessRelatedByVaisseau1Id(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getCasessRelatedByVaisseau1Id()
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            collCasessRelatedByVaisseau1Id = getCasessRelatedByVaisseau1Id(new Criteria(10));
        }
        return collCasessRelatedByVaisseau1Id;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau1Id from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCasessRelatedByVaisseau1Id(Criteria criteria) throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau1Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId() );
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
                if (!lastCasessRelatedByVaisseau1IdCriteria.equals(criteria))
                {
                    collCasessRelatedByVaisseau1Id = CasesPeer.doSelect(criteria);
                }
            }
        }
        lastCasessRelatedByVaisseau1IdCriteria = criteria;

        return collCasessRelatedByVaisseau1Id;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCasessRelatedByVaisseau1Id(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCasessRelatedByVaisseau1Id(Connection con) throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            collCasessRelatedByVaisseau1Id = getCasessRelatedByVaisseau1Id(new Criteria(10), con);
        }
        return collCasessRelatedByVaisseau1Id;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau1Id from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCasessRelatedByVaisseau1Id(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau1Id = new ArrayList();
            }
            else
            {
                 criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
                 collCasessRelatedByVaisseau1Id = CasesPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
                 if (!lastCasessRelatedByVaisseau1IdCriteria.equals(criteria))
                 {
                     collCasessRelatedByVaisseau1Id = CasesPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCasessRelatedByVaisseau1IdCriteria = criteria;

         return collCasessRelatedByVaisseau1Id;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau1Id from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getCasessRelatedByVaisseau1IdJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau1Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
            if (!lastCasessRelatedByVaisseau1IdCriteria.equals(criteria))
            {
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelectJoinPartie(criteria);
            }
        }
        lastCasessRelatedByVaisseau1IdCriteria = criteria;

        return collCasessRelatedByVaisseau1Id;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau1Id from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getCasessRelatedByVaisseau1IdJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau1Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
            if (!lastCasessRelatedByVaisseau1IdCriteria.equals(criteria))
            {
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelectJoinObjet(criteria);
            }
        }
        lastCasessRelatedByVaisseau1IdCriteria = criteria;

        return collCasessRelatedByVaisseau1Id;
    }

















    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau1Id from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getCasessRelatedByVaisseau1IdJoinVaisseauRelatedByVaisseau2Id(Criteria criteria)
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau1Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau1Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelectJoinVaisseauRelatedByVaisseau2Id(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CasesPeer.VAISSEAU1_ID, getVaisseauId());
            if (!lastCasessRelatedByVaisseau1IdCriteria.equals(criteria))
            {
                collCasessRelatedByVaisseau1Id = CasesPeer.doSelectJoinVaisseauRelatedByVaisseau2Id(criteria);
            }
        }
        lastCasessRelatedByVaisseau1IdCriteria = criteria;

        return collCasessRelatedByVaisseau1Id;
    }





    /**
     * Collection to store aggregation of collCasessRelatedByVaisseau2Id
     */
    protected List collCasessRelatedByVaisseau2Id;

    /**
     * Temporary storage of collCasessRelatedByVaisseau2Id to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCasessRelatedByVaisseau2Id()
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            collCasessRelatedByVaisseau2Id = new ArrayList();
        }
    }


    /**
     * Method called to associate a Cases object to this object
     * through the Cases foreign key attribute
     *
     * @param l Cases
     * @throws TorqueException
     */
    public void addCasesRelatedByVaisseau2Id(Cases l) throws TorqueException
    {
        getCasessRelatedByVaisseau2Id().add(l);
        l.setVaisseauRelatedByVaisseau2Id((Vaisseau) this);
    }

    /**
     * Method called to associate a Cases object to this object
     * through the Cases foreign key attribute using connection.
     *
     * @param l Cases
     * @throws TorqueException
     */
    public void addCasesRelatedByVaisseau2Id(Cases l, Connection con) throws TorqueException
    {
        getCasessRelatedByVaisseau2Id(con).add(l);
        l.setVaisseauRelatedByVaisseau2Id((Vaisseau) this);
    }

    /**
     * The criteria used to select the current contents of collCasessRelatedByVaisseau2Id
     */
    private Criteria lastCasessRelatedByVaisseau2IdCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCasessRelatedByVaisseau2Id(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getCasessRelatedByVaisseau2Id()
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            collCasessRelatedByVaisseau2Id = getCasessRelatedByVaisseau2Id(new Criteria(10));
        }
        return collCasessRelatedByVaisseau2Id;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau2Id from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCasessRelatedByVaisseau2Id(Criteria criteria) throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau2Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId() );
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
                if (!lastCasessRelatedByVaisseau2IdCriteria.equals(criteria))
                {
                    collCasessRelatedByVaisseau2Id = CasesPeer.doSelect(criteria);
                }
            }
        }
        lastCasessRelatedByVaisseau2IdCriteria = criteria;

        return collCasessRelatedByVaisseau2Id;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCasessRelatedByVaisseau2Id(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCasessRelatedByVaisseau2Id(Connection con) throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            collCasessRelatedByVaisseau2Id = getCasessRelatedByVaisseau2Id(new Criteria(10), con);
        }
        return collCasessRelatedByVaisseau2Id;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau2Id from storage.
     * If this Vaisseau is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCasessRelatedByVaisseau2Id(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau2Id = new ArrayList();
            }
            else
            {
                 criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
                 collCasessRelatedByVaisseau2Id = CasesPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
                 if (!lastCasessRelatedByVaisseau2IdCriteria.equals(criteria))
                 {
                     collCasessRelatedByVaisseau2Id = CasesPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCasessRelatedByVaisseau2IdCriteria = criteria;

         return collCasessRelatedByVaisseau2Id;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau2Id from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getCasessRelatedByVaisseau2IdJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau2Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
            if (!lastCasessRelatedByVaisseau2IdCriteria.equals(criteria))
            {
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelectJoinPartie(criteria);
            }
        }
        lastCasessRelatedByVaisseau2IdCriteria = criteria;

        return collCasessRelatedByVaisseau2Id;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau2Id from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getCasessRelatedByVaisseau2IdJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau2Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
            if (!lastCasessRelatedByVaisseau2IdCriteria.equals(criteria))
            {
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelectJoinObjet(criteria);
            }
        }
        lastCasessRelatedByVaisseau2IdCriteria = criteria;

        return collCasessRelatedByVaisseau2Id;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Vaisseau is new, it will return
     * an empty collection; or if this Vaisseau has previously
     * been saved, it will retrieve related CasessRelatedByVaisseau2Id from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Vaisseau.
     */
    protected List getCasessRelatedByVaisseau2IdJoinVaisseauRelatedByVaisseau1Id(Criteria criteria)
        throws TorqueException
    {
        if (collCasessRelatedByVaisseau2Id == null)
        {
            if (isNew())
            {
               collCasessRelatedByVaisseau2Id = new ArrayList();
            }
            else
            {
                criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelectJoinVaisseauRelatedByVaisseau1Id(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(CasesPeer.VAISSEAU2_ID, getVaisseauId());
            if (!lastCasessRelatedByVaisseau2IdCriteria.equals(criteria))
            {
                collCasessRelatedByVaisseau2Id = CasesPeer.doSelectJoinVaisseauRelatedByVaisseau1Id(criteria);
            }
        }
        lastCasessRelatedByVaisseau2IdCriteria = criteria;

        return collCasessRelatedByVaisseau2Id;
    }











        
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
            fieldNames.add("VaisseauId");
            fieldNames.add("Nom");
            fieldNames.add("Attaque");
            fieldNames.add("Degats");
            fieldNames.add("Champdeforce");
            fieldNames.add("Energie");
            fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by field (Java) name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
        if (name.equals("VaisseauId"))
        {
            return new Integer(getVaisseauId());
        }
        if (name.equals("Nom"))
        {
            return getNom();
        }
        if (name.equals("Attaque"))
        {
            return new Integer(getAttaque());
        }
        if (name.equals("Degats"))
        {
            return new Integer(getDegats());
        }
        if (name.equals("Champdeforce"))
        {
            return new Integer(getChampdeforce());
        }
        if (name.equals("Energie"))
        {
            return new Integer(getEnergie());
        }
        return null;
    }

    /**
     * Set a field in the object by field (Java) name.
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByName(String name, Object value )
        throws TorqueException, IllegalArgumentException
    {
        if (name.equals("VaisseauId"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setVaisseauId(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Nom"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setNom((String) value);
            return true;
        }
        if (name.equals("Attaque"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setAttaque(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Degats"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setDegats(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Champdeforce"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setChampdeforce(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Energie"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setEnergie(((Integer) value).intValue());
            return true;
        }
        return false;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
        if (name.equals(VaisseauPeer.VAISSEAU_ID))
        {
            return new Integer(getVaisseauId());
        }
        if (name.equals(VaisseauPeer.NOM))
        {
            return getNom();
        }
        if (name.equals(VaisseauPeer.ATTAQUE))
        {
            return new Integer(getAttaque());
        }
        if (name.equals(VaisseauPeer.DEGATS))
        {
            return new Integer(getDegats());
        }
        if (name.equals(VaisseauPeer.CHAMPDEFORCE))
        {
            return new Integer(getChampdeforce());
        }
        if (name.equals(VaisseauPeer.ENERGIE))
        {
            return new Integer(getEnergie());
        }
        return null;
    }

    /**
     * Set field values by Peer Field Name
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPeerName(String name, Object value)
        throws TorqueException, IllegalArgumentException
    {
      if (VaisseauPeer.VAISSEAU_ID.equals(name))
        {
            return setByName("VaisseauId", value);
        }
      if (VaisseauPeer.NOM.equals(name))
        {
            return setByName("Nom", value);
        }
      if (VaisseauPeer.ATTAQUE.equals(name))
        {
            return setByName("Attaque", value);
        }
      if (VaisseauPeer.DEGATS.equals(name))
        {
            return setByName("Degats", value);
        }
      if (VaisseauPeer.CHAMPDEFORCE.equals(name))
        {
            return setByName("Champdeforce", value);
        }
      if (VaisseauPeer.ENERGIE.equals(name))
        {
            return setByName("Energie", value);
        }
        return false;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
        if (pos == 0)
        {
            return new Integer(getVaisseauId());
        }
        if (pos == 1)
        {
            return getNom();
        }
        if (pos == 2)
        {
            return new Integer(getAttaque());
        }
        if (pos == 3)
        {
            return new Integer(getDegats());
        }
        if (pos == 4)
        {
            return new Integer(getChampdeforce());
        }
        if (pos == 5)
        {
            return new Integer(getEnergie());
        }
        return null;
    }

    /**
     * Set field values by its position (zero based) in the XML schema.
     *
     * @param position The field position
     * @param value field value
     * @return True if value was set, false if not (invalid position / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPosition(int position, Object value)
        throws TorqueException, IllegalArgumentException
    {
    if (position == 0)
        {
            return setByName("VaisseauId", value);
        }
    if (position == 1)
        {
            return setByName("Nom", value);
        }
    if (position == 2)
        {
            return setByName("Attaque", value);
        }
    if (position == 3)
        {
            return setByName("Degats", value);
        }
    if (position == 4)
        {
            return setByName("Champdeforce", value);
        }
    if (position == 5)
        {
            return setByName("Energie", value);
        }
        return false;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
        save(VaisseauPeer.DATABASE_NAME);
    }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
     *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
        try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
    }

    /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
        if (!alreadyInSave)
        {
            alreadyInSave = true;



            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    VaisseauPeer.doInsert((Vaisseau) this, con);
                    setNew(false);
                }
                else
                {
                    VaisseauPeer.doUpdate((Vaisseau) this, con);
                }
            }


            if (collInventaires != null)
            {
                for (int i = 0; i < collInventaires.size(); i++)
                {
                    ((Inventaire) collInventaires.get(i)).save(con);
                }
            }

            if (collPlayers != null)
            {
                for (int i = 0; i < collPlayers.size(); i++)
                {
                    ((Player) collPlayers.get(i)).save(con);
                }
            }

            if (collCasessRelatedByVaisseau1Id != null)
            {
                for (int i = 0; i < collCasessRelatedByVaisseau1Id.size(); i++)
                {
                    ((Cases) collCasessRelatedByVaisseau1Id.get(i)).save(con);
                }
            }

            if (collCasessRelatedByVaisseau2Id != null)
            {
                for (int i = 0; i < collCasessRelatedByVaisseau2Id.size(); i++)
                {
                    ((Cases) collCasessRelatedByVaisseau2Id.get(i)).save(con);
                }
            }
            alreadyInSave = false;
        }
    }


    /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key vaisseauId ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
        setVaisseauId(((NumberKey) key).intValue());
    }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
        setVaisseauId(Integer.parseInt(key));
    }


    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
        return SimpleKey.keyFor(getVaisseauId());
    }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     */
    public Vaisseau copy() throws TorqueException
    {
        return copy(true);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     *
     * @param con the database connection to read associated objects.
     */
    public Vaisseau copy(Connection con) throws TorqueException
    {
        return copy(true, con);
    }

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     */
    public Vaisseau copy(boolean deepcopy) throws TorqueException
    {
        return copyInto(new Vaisseau(), deepcopy);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     * @param con the database connection to read associated objects.
     */
    public Vaisseau copy(boolean deepcopy, Connection con) throws TorqueException
    {
        return copyInto(new Vaisseau(), deepcopy, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     */
    protected Vaisseau copyInto(Vaisseau copyObj) throws TorqueException
    {
        return copyInto(copyObj, true);
    }

  
    /**
     * Fills the copyObj with the contents of this object using connection.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param con the database connection to read associated objects.
     */
    protected Vaisseau copyInto(Vaisseau copyObj, Connection con) throws TorqueException
    {
        return copyInto(copyObj, true, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     */
    protected Vaisseau copyInto(Vaisseau copyObj, boolean deepcopy) throws TorqueException
    {
        copyObj.setVaisseauId(vaisseauId);
        copyObj.setNom(nom);
        copyObj.setAttaque(attaque);
        copyObj.setDegats(degats);
        copyObj.setChampdeforce(champdeforce);
        copyObj.setEnergie(energie);

        copyObj.setVaisseauId( 0);

        if (deepcopy)
        {


        List vInventaires = getInventaires();
        if (vInventaires != null)
        {
            for (int i = 0; i < vInventaires.size(); i++)
            {
                Inventaire obj = (Inventaire) vInventaires.get(i);
                copyObj.addInventaire(obj.copy());
            }
        }
        else
        {
            copyObj.collInventaires = null;
        }


        List vPlayers = getPlayers();
        if (vPlayers != null)
        {
            for (int i = 0; i < vPlayers.size(); i++)
            {
                Player obj = (Player) vPlayers.get(i);
                copyObj.addPlayer(obj.copy());
            }
        }
        else
        {
            copyObj.collPlayers = null;
        }


        List vCasessRelatedByVaisseau1Id = getCasessRelatedByVaisseau1Id();
        if (vCasessRelatedByVaisseau1Id != null)
        {
            for (int i = 0; i < vCasessRelatedByVaisseau1Id.size(); i++)
            {
                Cases obj = (Cases) vCasessRelatedByVaisseau1Id.get(i);
                copyObj.addCasesRelatedByVaisseau1Id(obj.copy());
            }
        }
        else
        {
            copyObj.collCasessRelatedByVaisseau1Id = null;
        }


        List vCasessRelatedByVaisseau2Id = getCasessRelatedByVaisseau2Id();
        if (vCasessRelatedByVaisseau2Id != null)
        {
            for (int i = 0; i < vCasessRelatedByVaisseau2Id.size(); i++)
            {
                Cases obj = (Cases) vCasessRelatedByVaisseau2Id.get(i);
                copyObj.addCasesRelatedByVaisseau2Id(obj.copy());
            }
        }
        else
        {
            copyObj.collCasessRelatedByVaisseau2Id = null;
        }
        }
        return copyObj;
    }
        
    
    /**
     * Fills the copyObj with the contents of this object using connection.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     * @param con the database connection to read associated objects.
     */
    protected Vaisseau copyInto(Vaisseau copyObj, boolean deepcopy, Connection con) throws TorqueException
    {
        copyObj.setVaisseauId(vaisseauId);
        copyObj.setNom(nom);
        copyObj.setAttaque(attaque);
        copyObj.setDegats(degats);
        copyObj.setChampdeforce(champdeforce);
        copyObj.setEnergie(energie);

        copyObj.setVaisseauId( 0);

        if (deepcopy)
        {


        List vInventaires = getInventaires(con);
        if (vInventaires != null)
        {
            for (int i = 0; i < vInventaires.size(); i++)
            {
                Inventaire obj = (Inventaire) vInventaires.get(i);
                copyObj.addInventaire(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collInventaires = null;
        }


        List vPlayers = getPlayers(con);
        if (vPlayers != null)
        {
            for (int i = 0; i < vPlayers.size(); i++)
            {
                Player obj = (Player) vPlayers.get(i);
                copyObj.addPlayer(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collPlayers = null;
        }


        List vCasessRelatedByVaisseau1Id = getCasessRelatedByVaisseau1Id(con);
        if (vCasessRelatedByVaisseau1Id != null)
        {
            for (int i = 0; i < vCasessRelatedByVaisseau1Id.size(); i++)
            {
                Cases obj = (Cases) vCasessRelatedByVaisseau1Id.get(i);
                copyObj.addCasesRelatedByVaisseau1Id(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collCasessRelatedByVaisseau1Id = null;
        }


        List vCasessRelatedByVaisseau2Id = getCasessRelatedByVaisseau2Id(con);
        if (vCasessRelatedByVaisseau2Id != null)
        {
            for (int i = 0; i < vCasessRelatedByVaisseau2Id.size(); i++)
            {
                Cases obj = (Cases) vCasessRelatedByVaisseau2Id.get(i);
                copyObj.addCasesRelatedByVaisseau2Id(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collCasessRelatedByVaisseau2Id = null;
        }
        }
        return copyObj;
    }
    
    

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public VaisseauPeer getPeer()
    {
        return peer;
    }

    /**
     * Retrieves the TableMap object related to this Table data without
     * compiler warnings of using getPeer().getTableMap().
     *
     * @return The associated TableMap object.
     */
    public TableMap getTableMap() throws TorqueException
    {
        return VaisseauPeer.getTableMap();
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Vaisseau:\n");
        str.append("VaisseauId = ")
           .append(getVaisseauId())
           .append("\n");
        str.append("Nom = ")
           .append(getNom())
           .append("\n");
        str.append("Attaque = ")
           .append(getAttaque())
           .append("\n");
        str.append("Degats = ")
           .append(getDegats())
           .append("\n");
        str.append("Champdeforce = ")
           .append(getChampdeforce())
           .append("\n");
        str.append("Energie = ")
           .append(getEnergie())
           .append("\n");
        return(str.toString());
    }
}
